package com.water.wfo.component.constant.enums;

/**
 * packageName com.water.wfo.component.constant.enums
 *
 * @author
 * @interfaceName CacheKeyEnum(处以class为网)
 * @date 2025/3/13
 * @description T0D0
 */
public enum CacheKeyEnum {
    WFO_FICATION("WFO_FICATION_%s", 30*60L, "", "验证"),
    ;
    CacheKeyEnum(String key, long timeout, String defaultValue, String desc){
        this.key = key;
        this.timeout = timeout;
        this.defaultValue = defaultValue;
        this.desc = desc;
    }

    /**
     * 缓存key，
     * 如果是缓存前缀，则需要在最后带下换线_，如key_prefix_
     */
    private String key;

    /**
     * 超时时间(-1L，无超时时间，0:代表空值，不设置缓存)
     */
    private long timeout;

    /**
     * 默认值
     */
    private String defaultValue;

    /**
     * 备注描述
     */
    private String desc;

    public String getKey() {
        return key;
    }

    public String desKey(String... vars) {
        if (null == vars || vars.length < 1){
            return key;
        }
        return String.format(key, vars);
    }

    public long getTimeout() {
        return timeout;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public String getDesc() {
        return desc;
    }
}
